package Code;

public enum CalcStatistics {;
	
	public static double calcBeliefOcc(double oldOcc, boolean hit, double trueHit, double trueMiss)
	{
		double belOcc = 0;
		double belUnocc = 0;
		if (hit)
		{
			//belOcc = P(hit|occupied)P(occupied) = P(occupied|hit)
			belOcc = trueHit*oldOcc;
			//belUnocc = P(hit|unoccupied)P(unoccupied) = P(unoccupied|hit)
			belUnocc = (1-trueMiss)*(1-oldOcc);
		}
		else
		{
			//belOcc = P(miss|occupied)P(occupied) = P(occupied|miss)
			belOcc = (1-trueHit)*oldOcc;
			//belUnocc = P(miss|unoccupied)P(unoccupied) = P(unoccupied|miss)
			belUnocc = trueMiss*(1-oldOcc);
		}
		
		//normalize belOcc
		double sum = belOcc + belUnocc;
		return belOcc/sum;
	}
}
